<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>节流防抖</title>
</head>
<body>
	<button>点击</button>
</body>
<script>
	let btn = document.getElementsByTagName('button')[0];
	function tap_fun(long) {
		let timeobj = null;
		return function() {
			if(timeobj) { clearTimeout(timeobj) }
			timeobj = setTimeout(()=>{ console.log(long) }, long);
		}
	}
	btn.onclick = tap_fun(500);
</script>
</html>